#include "mainwindow.h"
#include "ui_mainwindow.h"
//#include "typeinfo"
#include <QtCore>
#include <QtGui>
#include <QtDeclarative>
#include <QtWebKit>

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    QDeclarativeView *viewer = new QDeclarativeView;

    QDeclarativeContext *context = viewer->rootContext();
    context->setContextProperty("backend", this);

    viewer->setSource(QUrl("qrc:/qml/main.qml"));
//    viewer.setAttribute(Qt::WA_AutoOrientation, true);
    viewer->setResizeMode(QDeclarativeView::SizeRootObjectToView);
    viewer->setMinimumWidth(400);
    viewer->setMaximumWidth(400);
    viewer->setMinimumHeight(400);
//    QVBoxLayout *layout = new QVBoxLayout;
//    layout->addWidget(viewer);
//    ui->tab_2->setLayout(layout);
    ui->verticalLayout_qml->addWidget(viewer);

//    QDeclarativeView *status_view = new QDeclarativeView;

//    QDeclarativeContext *context_status = status_view->rootContext();
//    context_status->setContextProperty("backend", this);

//    status_view->setSource(QUrl("qrc:/qml/StatusBar.qml"));
//    status_view->setResizeMode(QDeclarativeView::SizeRootObjectToView);
//    status_view->setMinimumWidth(400);
//    status_view->setMinimumHeight(60);

//    ui->horizontalLayout_status->addWidget(status_view);
//    qDebug() << "width and height : " << this->width() << " , " << this->height();

    connect(ui->webView, SIGNAL(loadFinished(bool)), this, SLOT(html_load_finish()));

    curr_pos_x = setting.value("map/poi_x").toString();
    curr_pos_y = setting.value("map/poi_y").toString();
    curr_pos_zoom = setting.value("map/poi_zoom").toString();
    curr_city = setting.value("map/poi_city", "010").toString();
//    emit city_code(curr_city);
}

MainWindow::~MainWindow()
{
    delete ui;
    setting.setValue("map/poi_x", curr_pos_x);
    setting.setValue("map/poi_y", curr_pos_y);
    setting.setValue("map/poi_zoom", curr_pos_zoom);
    setting.setValue("map/poi_city", curr_city);
}

////////////////////////////////////////////////////////////////////////////////////////  for html use
void MainWindow::log(QString input)
{
    qDebug() << "html console : " << input;
}

void MainWindow::poi_result_in(QVariantMap input)
{
//    qDebug() << "poi_result_in : " << input;
    qDebug() << "status : " << input.value("status");
    emit search_result(input);
}

void MainWindow::bus_navi_result_in(QVariantMap input)
{
    qDebug() << "status : " << input.value("status");
    emit bus_navi_result(input);
}

void MainWindow::bus_sta_result_in(QVariantMap input)
{
    qDebug() << "status : " << input.value("status");
    emit bus_sta_result(input);
}

void MainWindow::bus_line_result_in(QVariantMap input)
{
    qDebug() << "status : " << input.value("status");
    emit bus_line_result(input);
}

void MainWindow::car_navi_result_in(QVariantMap input)
{
    qDebug() << "status : " << input.value("status");
    emit car_navi_result(input);
}

void MainWindow::set_start_poi(QString poi)
{
    qDebug() << "set_start_poi : " << poi;
    emit poi_start(poi);
}

void MainWindow::set_end_poi(QString poi)
{
    qDebug() << "set_end_poi : " << poi;
    emit poi_end(poi);
}

void MainWindow::set_city_code(QString code)
{
    qDebug() << "set_city_code : " << code;
    emit city_code(code);
    curr_city = code;
}

void MainWindow::set_map_xyz(QString poi_x, QString poi_y, QString poi_zoom)
{
    //qDebug() << "xyz : " <<  poi_x + " , " + poi_y + " , " + poi_zoom;
    curr_pos_x = poi_x;
    curr_pos_y = poi_y;
    curr_pos_zoom = poi_zoom;
}

////////////////////////////////////////////////////////////////////////////////////////   for self use
void MainWindow::html_load_finish()
{
    qDebug() << " html load finish ";
    mainpage = ui->webView->page();
    mainframe = mainpage->mainFrame();
    mainframe->addToJavaScriptWindowObject("mainwindow", this);
//    mainframe->evaluateJavaScript("mainwindow.log('test2 from cpp');");
    emit map_load_finish();
    emit city_code(curr_city);
    //qDebug() << "xyz : " <<  curr_pos_x + " , " + curr_pos_y + " , " + curr_pos_zoom;
    mainframe->evaluateJavaScript("mapObj.setZoomAndCenter('" + curr_pos_zoom + "',new AMap.LngLat('" + curr_pos_x + "','" + curr_pos_y + "'))");
}

////////////////////////////////////////////////////////////////////////////////////////   for qml use
void MainWindow::set_html_city(QString city)
{
    if (mainframe != 0)
    mainframe->evaluateJavaScript("mapObj.setCity('" + city + "')");
//    mainframe->evaluateJavaScript("var kw = 'kfc';");
//    mainframe->evaluateJavaScript("var lonlat = mapObj.getCenter();");
//    mainframe->evaluateJavaScript("keywordSearch()");
//    mainframe->evaluateJavaScript("mainwindow.log(mapObj.getBounds().toString());");
}

void MainWindow::search_poi(QString keyword)
{
//    mainframe->evaluateJavaScript("var kw = 'aaaaaa';");
//    qDebug() << "keyword : " << keyword;
    if (mainframe != 0)
    {
    mainframe->evaluateJavaScript("var kw = '" + keyword + "';");
    mainframe->evaluateJavaScript("var lonlat = mapObj.getCenter();");
    mainframe->evaluateJavaScript("keywordSearch()");
    }
}

void MainWindow::bus_navi(QString start_x, QString start_y, QString end_x, QString end_y, QString citycode)
{
    if (mainframe != 0)
    {
    mainframe->evaluateJavaScript("busS.start_x = '" + start_x + "';");
    mainframe->evaluateJavaScript("busS.start_y = '" + start_y + "';");
    mainframe->evaluateJavaScript("busS.end_x = '" + end_x + "';");
    mainframe->evaluateJavaScript("busS.end_y = '" + end_y + "';");
    mainframe->evaluateJavaScript("bus_search('" + citycode + "')");
    }
}

void MainWindow::bus_station(QString keyword, QString citycode)
{
    if (mainframe != 0)
    mainframe->evaluateJavaScript("StationSearch('" + keyword + "', '" + citycode + "')");
}

void MainWindow::bus_line(QString busline_id, QString bus_city)
{
    if (mainframe != 0)
    mainframe->evaluateJavaScript("bus_line_search('" + busline_id + "', '" + bus_city + "')");
}

void MainWindow::car_navi(QString start_x, QString start_y, QString end_x, QString end_y, QString drive_type)
{
    if (mainframe != 0)
    {
    mainframe->evaluateJavaScript("routeS.start_x = '" + start_x + "';");
    mainframe->evaluateJavaScript("routeS.start_y = '" + start_y + "';");
    mainframe->evaluateJavaScript("routeS.end_x = '" + end_x + "';");
    mainframe->evaluateJavaScript("routeS.end_y = '" + end_y + "';");
    mainframe->evaluateJavaScript("routeChangeSearchXY('" + drive_type + "')");
    }
}

void MainWindow::show_status(QString color, QString status)
{
    emit send_status(color, status);
}

void MainWindow::draw_bus_change_line(QString num)
{
    if (mainframe != 0)
        mainframe->evaluateJavaScript("drawBuschangeLine(" + num + ")");
}

void MainWindow::draw_bus_line_station(QString px, QString py, QString serialid, QString pn, QString linename)
{
    if (mainframe != 0)
        mainframe->evaluateJavaScript("drawSinglePoi('" + px + "','" + py + "','" + serialid + "','" + pn + "','" + linename + "')");
}

void MainWindow::map_pan_to(QString poi_x, QString poi_y)
{
    if (mainframe != 0)
        mainframe->evaluateJavaScript("mapObj.panTo(new AMap.LngLat('" + poi_x + "','" + poi_y + "'))");
}

void MainWindow::show_message(QString title, QString content)
{
    QMessageBox::information(this, title, content);
}

////////////////////////////////////////////////////////////////////////////////////////   for city actions
void MainWindow::on_action_clearmap_triggered()
{
    if (mainframe != 0)
    mainframe->evaluateJavaScript("mapObj.clearOverlays()");
}

void MainWindow::on_action_resetmap_triggered()
{
    ui->webView->reload();
}

void MainWindow::on_action_2_triggered()
{
    set_html_city("广州");
    set_city_code("020");
}

void MainWindow::on_action_3_triggered()
{
    set_html_city("北京");
    set_city_code("010");
}

void MainWindow::on_action_386_triggered()
{
    set_html_city("楚雄");
    set_city_code("0878");
}

void MainWindow::on_action_AesyPig_triggered()
{
    QMessageBox::about(this, "关于AesyPig", "AesyPig Desktop version 1.0<br><br>致力于开发开源、开放的跨平台网络地图软件<br><br>版权所有 Joey Chan : qqworini@gmail.com  基于GPL V3协议发布<br><br>**该版本使用高德地图提供的API，一切地图数据及服务的版权、解释权归高德地图所有");
}

void MainWindow::on_action_QT_triggered()
{
    QMessageBox::aboutQt(this, "关于QT");
}

void MainWindow::on_action_4_triggered()
{
    set_html_city("上海");
    set_city_code("021");
}

void MainWindow::on_action_5_triggered()
{
    set_html_city("天津");
    set_city_code("022");
}

void MainWindow::on_action_6_triggered()
{
    set_html_city("广州");
    set_city_code("020");
}

void MainWindow::on_action_7_triggered()
{
    set_html_city("深圳");
    set_city_code("0755");
}

void MainWindow::on_action_8_triggered()
{
    set_html_city("成都");
    set_city_code("028");
}

void MainWindow::on_action_9_triggered()
{
    set_html_city("西安");
    set_city_code("029");
}

void MainWindow::on_action_10_triggered()
{
    set_html_city("南京");
    set_city_code("025");
}

void MainWindow::on_action_11_triggered()
{
    set_html_city("重庆");
    set_city_code("023");
}

void MainWindow::on_action_53_triggered()
{
    set_html_city("合肥");
    set_city_code("0551");
}

void MainWindow::on_action_54_triggered()
{
    set_html_city("安庆");
    set_city_code("0556");
}

void MainWindow::on_action_55_triggered()
{
    set_html_city("蚌埠");
    set_city_code("0552");
}

void MainWindow::on_action_56_triggered()
{
    set_html_city("巢湖");
    set_city_code("0565");
}

void MainWindow::on_action_57_triggered()
{
    set_html_city("池州");
    set_city_code("贵池");
}

void MainWindow::on_action_58_triggered()
{
    set_html_city("滁州");
    set_city_code("0550");
}

void MainWindow::on_action_59_triggered()
{
    set_html_city("阜阳");
    set_city_code("0558");
}

void MainWindow::on_action_60_triggered()
{
    set_html_city("亳州");
    set_city_code("0557");
}

void MainWindow::on_action_61_triggered()
{
    set_html_city("淮北");
    set_city_code("0561");
}

void MainWindow::on_action_62_triggered()
{
    set_html_city("淮南");
    set_city_code("0554");
}

void MainWindow::on_action_63_triggered()
{
    set_html_city("黄山");
    set_city_code("0559");
}

void MainWindow::on_action_64_triggered()
{
    set_html_city("六安");
    set_city_code("0564");
}

void MainWindow::on_action_65_triggered()
{
    set_html_city("马鞍山");
    set_city_code("0555");
}

void MainWindow::on_action_66_triggered()
{
    set_html_city("宿州");
    set_city_code("0557");
}

void MainWindow::on_action_67_triggered()
{
    set_html_city("铜陵");
    set_city_code("0562");
}

void MainWindow::on_action_68_triggered()
{
    set_html_city("芜湖");
    set_city_code("0553");
}

void MainWindow::on_action_69_triggered()
{
    set_html_city("宣城");
    set_city_code("0563");
}

void MainWindow::on_action_70_triggered()
{
    set_html_city("福州");
    set_city_code("0591");
}

void MainWindow::on_action_71_triggered()
{
    set_html_city("龙岩");
    set_city_code("0597");
}

void MainWindow::on_action_72_triggered()
{
    set_html_city("南平");
    set_city_code("0599");
}

void MainWindow::on_action_73_triggered()
{
    set_html_city("宁德");
    set_city_code("0593");
}

void MainWindow::on_action_74_triggered()
{
    set_html_city("莆田");
    set_city_code("0594");
}

void MainWindow::on_action_75_triggered()
{
    set_html_city("泉州");
    set_city_code("0595");
}

void MainWindow::on_action_76_triggered()
{
    set_html_city("三明");
    set_city_code("0598");
}

void MainWindow::on_action_77_triggered()
{
    set_html_city("厦门");
    set_city_code("0592");
}

void MainWindow::on_action_78_triggered()
{
    set_html_city("漳州");
    set_city_code("0596");
}

void MainWindow::on_action_79_triggered()
{
    set_html_city("兰州");
    set_city_code("0931");
}

void MainWindow::on_action_80_triggered()
{
    set_html_city("白银");
    set_city_code("0943");
}

void MainWindow::on_action_81_triggered()
{
    set_html_city("定西");
    set_city_code("0932");
}

void MainWindow::on_action_82_triggered()
{
    set_html_city("甘南");
    set_city_code("0941");
}

void MainWindow::on_action_83_triggered()
{
    set_html_city("嘉峪关");
    set_city_code("0937");
}

void MainWindow::on_action_84_triggered()
{
    set_html_city("金昌");
    set_city_code("0935");
}

void MainWindow::on_action_85_triggered()
{
    set_html_city("酒泉");
    set_city_code("0937");
}

void MainWindow::on_action_86_triggered()
{
    set_html_city("临夏");
    set_city_code("0930");
}

void MainWindow::on_action_87_triggered()
{
//    set_html_city("陇南");
//    set_city_code("020");
}

void MainWindow::on_action_88_triggered()
{
    set_html_city("平凉");
    set_city_code("0933");
}

void MainWindow::on_action_89_triggered()
{
//    set_html_city("庆阳");
//    set_city_code("020");
}

void MainWindow::on_action_90_triggered()
{
    set_html_city("天水");
    set_city_code("0938");
}

void MainWindow::on_action_91_triggered()
{
    set_html_city("武威");
    set_city_code("0935");
}

void MainWindow::on_action_92_triggered()
{
    set_html_city("张掖");
    set_city_code("0936");
}

void MainWindow::on_action_93_triggered()
{
    set_html_city("潮州");
    set_city_code("0768");
}

void MainWindow::on_action_94_triggered()
{
    set_html_city("东莞");
    set_city_code("0769");
}

void MainWindow::on_action_95_triggered()
{
    set_html_city("佛山");
    set_city_code("0757");
}

void MainWindow::on_action_96_triggered()
{
    set_html_city("惠州");
    set_city_code("0752");
}

void MainWindow::on_action_97_triggered()
{
    set_html_city("河源");
    set_city_code("0762");
}

void MainWindow::on_action_98_triggered()
{
    set_html_city("揭阳");
    set_city_code("0663");
}

void MainWindow::on_action_99_triggered()
{
    set_html_city("江门");
    set_city_code("0750");
}

void MainWindow::on_action_100_triggered()
{
    set_html_city("梅州");
    set_city_code("0753");
}

void MainWindow::on_action_101_triggered()
{
    set_html_city("茂名");
    set_city_code("0668");
}

void MainWindow::on_action_102_triggered()
{
    set_html_city("清远");
    set_city_code("0763");
}

void MainWindow::on_action_103_triggered()
{
    set_html_city("深圳");
    set_city_code("0755");
}

void MainWindow::on_action_104_triggered()
{
    set_html_city("汕头");
    set_city_code("0754");
}

void MainWindow::on_action_105_triggered()
{
    set_html_city("汕尾");
    set_city_code("0660");
}

void MainWindow::on_action_106_triggered()
{
    set_html_city("韶关");
    set_city_code("0751");
}

void MainWindow::on_action_107_triggered()
{
    set_html_city("阳江");
    set_city_code("0662");
}

void MainWindow::on_action_108_triggered()
{
    set_html_city("云浮");
    set_city_code("0766");
}

void MainWindow::on_action_109_triggered()
{
    set_html_city("珠海");
    set_city_code("0756");
}

void MainWindow::on_action_110_triggered()
{
    set_html_city("湛江");
    set_city_code("0759");
}

void MainWindow::on_action_111_triggered()
{
    set_html_city("中山");
    set_city_code("0760");
}

void MainWindow::on_action_112_triggered()
{
    set_html_city("肇庆");
    set_city_code("0758");
}

void MainWindow::on_action_113_triggered()
{
    set_html_city("南宁");
    set_city_code("0771");
}

void MainWindow::on_action_114_triggered()
{
    set_html_city("北海");
    set_city_code("0779");
}

void MainWindow::on_action_115_triggered()
{
    set_html_city("百色");
    set_city_code("0776");
}

void MainWindow::on_action_116_triggered()
{
    set_html_city("崇左");
    set_city_code("0771");
}

void MainWindow::on_action_117_triggered()
{
    set_html_city("防城港");
    set_city_code("0770");
}

void MainWindow::on_action_118_triggered()
{
    set_html_city("桂林");
    set_city_code("0773");
}

void MainWindow::on_action_119_triggered()
{
    set_html_city("贵港");
    set_city_code("0775");
}

void MainWindow::on_action_120_triggered()
{
    set_html_city("贺州");
    set_city_code("0774");
}

void MainWindow::on_action_121_triggered()
{
    set_html_city("河池");
    set_city_code("0778");
}

void MainWindow::on_action_122_triggered()
{
    set_html_city("柳州");
    set_city_code("0772");
}

void MainWindow::on_action_123_triggered()
{
    set_html_city("来宾");
    set_city_code("0772");
}

void MainWindow::on_action_124_triggered()
{
    set_html_city("钦州");
    set_city_code("0777");
}

void MainWindow::on_action_125_triggered()
{
    set_html_city("梧州");
    set_city_code("0774");
}

void MainWindow::on_action_126_triggered()
{
    set_html_city("玉林");
    set_city_code("0775");
}

void MainWindow::on_action_127_triggered()
{
    set_html_city("贵阳");
    set_city_code("0851");
}

void MainWindow::on_action_128_triggered()
{
    set_html_city("安顺");
    set_city_code("0853");
}

void MainWindow::on_action_129_triggered()
{
    set_html_city("毕节");
    set_city_code("0857");
}

void MainWindow::on_action_130_triggered()
{
    set_html_city("六盘水");
    set_city_code("0858");
}

void MainWindow::on_action_131_triggered()
{
    set_html_city("铜仁");
    set_city_code("0856");
}

void MainWindow::on_action_132_triggered()
{
    set_html_city("黔东南");
    set_city_code("0855");
}

void MainWindow::on_action_133_triggered()
{
    set_html_city("黔西南");
    set_city_code("0859");
}

void MainWindow::on_action_134_triggered()
{
    set_html_city("黔南");
    set_city_code("0854");
}

void MainWindow::on_action_135_triggered()
{
    set_html_city("遵义");
    set_city_code("0852");
}

void MainWindow::on_action_136_triggered()
{
    set_html_city("海口");
    set_city_code("0898");
}

void MainWindow::on_action_137_triggered()
{
    set_html_city("三亚");
    set_city_code("0899");
}

void MainWindow::on_action_138_triggered()
{
//    set_html_city("五指山");
//    set_city_code("020");
}

void MainWindow::on_action_139_triggered()
{
    set_html_city("琼海");
    set_city_code("0898");
}

void MainWindow::on_action_140_triggered()
{
    set_html_city("儋州");
    set_city_code("0890");
}

void MainWindow::on_action_141_triggered()
{
    set_html_city("文昌");
    set_city_code("0898");
}

void MainWindow::on_action_142_triggered()
{
    set_html_city("万宁");
    set_city_code("0898");
}

void MainWindow::on_action_143_triggered()
{
    set_html_city("东方");
    set_city_code("0890");
}

void MainWindow::on_action_144_triggered()
{
    set_html_city("定安");
    set_city_code("0898");
}

void MainWindow::on_action_145_triggered()
{
    set_html_city("屯昌");
    set_city_code("0898");
}

void MainWindow::on_action_146_triggered()
{
    set_html_city("澄迈");
    set_city_code("0898");
}

void MainWindow::on_action_147_triggered()
{
    set_html_city("临高");
    set_city_code("0890");
}

void MainWindow::on_action_148_triggered()
{
    set_html_city("白沙");
    set_city_code("0890");
}

void MainWindow::on_action_149_triggered()
{
    set_html_city("昌江");
    set_city_code("0890");
}

void MainWindow::on_action_150_triggered()
{
    set_html_city("乐东");
    set_city_code("0899");
}

void MainWindow::on_action_151_triggered()
{
    set_html_city("陵水");
    set_city_code("0899");
}

void MainWindow::on_action_152_triggered()
{
    set_html_city("保亭");
    set_city_code("0899");
}

void MainWindow::on_action_153_triggered()
{
    set_html_city("琼中");
    set_city_code("0899");
}

void MainWindow::on_action_154_triggered()
{
//    set_html_city("三沙");
//    set_city_code("020");
}

void MainWindow::on_action_155_triggered()
{
    set_html_city("石家庄");
    set_city_code("0311");
}

void MainWindow::on_action_156_triggered()
{
    set_html_city("保定");
    set_city_code("0312");
}

void MainWindow::on_action_157_triggered()
{
    set_html_city("沧州");
    set_city_code("0317");
}

void MainWindow::on_action_158_triggered()
{
    set_html_city("承德");
    set_city_code("0314");
}

void MainWindow::on_action_159_triggered()
{
    set_html_city("衡水");
    set_city_code("0318");
}

void MainWindow::on_action_160_triggered()
{
    set_html_city("邯郸");
    set_city_code("0310");
}

void MainWindow::on_action_161_triggered()
{
    set_html_city("廊坊");
    set_city_code("0316");
}

void MainWindow::on_action_162_triggered()
{
    set_html_city("秦皇岛");
    set_city_code("0335");
}

void MainWindow::on_action_163_triggered()
{
    set_html_city("唐山");
    set_city_code("0315");
}

void MainWindow::on_action_164_triggered()
{
    set_html_city("邢台");
    set_city_code("0319");
}

void MainWindow::on_action_165_triggered()
{
    set_html_city("张家口");
    set_city_code("0313");
}

void MainWindow::on_action_166_triggered()
{
    set_html_city("郑州");
    set_city_code("0371");
}

void MainWindow::on_action_167_triggered()
{
    set_html_city("安阳");
    set_city_code("0372");
}

void MainWindow::on_action_168_triggered()
{
    set_html_city("鹤壁");
    set_city_code("0392");
}

void MainWindow::on_action_169_triggered()
{
    set_html_city("焦作");
    set_city_code("0391");
}

void MainWindow::on_action_170_triggered()
{
    set_html_city("开封");
    set_city_code("0378");
}

void MainWindow::on_action_171_triggered()
{
    set_html_city("洛阳");
    set_city_code("0379");
}

void MainWindow::on_action_172_triggered()
{
    set_html_city("漯河");
    set_city_code("0395");
}

void MainWindow::on_action_173_triggered()
{
    set_html_city("南阳");
    set_city_code("0377");
}

void MainWindow::on_action_174_triggered()
{
    set_html_city("濮阳");
    set_city_code("0393");
}

void MainWindow::on_action_175_triggered()
{
    set_html_city("平顶山");
    set_city_code("0375");
}

void MainWindow::on_action_176_triggered()
{
    set_html_city("三门峡");
    set_city_code("0398");
}

void MainWindow::on_action_177_triggered()
{
    set_html_city("商丘");
    set_city_code("0370");
}

void MainWindow::on_action_178_triggered()
{
    set_html_city("新乡");
    set_city_code("0373");
}

void MainWindow::on_action_179_triggered()
{
    set_html_city("信阳");
    set_city_code("0376");
}

void MainWindow::on_action_180_triggered()
{
    set_html_city("许昌");
    set_city_code("0374");
}

void MainWindow::on_action_181_triggered()
{
    set_html_city("驻马店");
    set_city_code("0396");
}

void MainWindow::on_action_182_triggered()
{
    set_html_city("周口");
    set_city_code("0394");
}

void MainWindow::on_action_183_triggered()
{
    set_html_city("济源");
    set_city_code("0391");
}

void MainWindow::on_action_184_triggered()
{
    set_html_city("哈尔滨");
    set_city_code("0451");
}

void MainWindow::on_action_185_triggered()
{
    set_html_city("大庆");
    set_city_code("0459");
}

void MainWindow::on_action_186_triggered()
{
    set_html_city("大兴安岭");
    set_city_code("0457");
}

void MainWindow::on_action_187_triggered()
{
    set_html_city("鹤岗");
    set_city_code("0468");
}

void MainWindow::on_action_188_triggered()
{
    set_html_city("黑河");
    set_city_code("0456");
}

void MainWindow::on_action_189_triggered()
{
    set_html_city("鸡西");
    set_city_code("0467");
}

void MainWindow::on_action_190_triggered()
{
    set_html_city("佳木斯");
    set_city_code("0454");
}

void MainWindow::on_action_191_triggered()
{
    set_html_city("牡丹江");
    set_city_code("0453");
}

void MainWindow::on_action_192_triggered()
{
    set_html_city("七台河");
    set_city_code("0464");
}

void MainWindow::on_action_193_triggered()
{
    set_html_city("齐齐哈尔");
    set_city_code("0452");
}

void MainWindow::on_action_194_triggered()
{
    set_html_city("双鸭山");
    set_city_code("0469");
}

void MainWindow::on_action_195_triggered()
{
    set_html_city("绥化");
    set_city_code("0455");
}

void MainWindow::on_action_196_triggered()
{
    set_html_city("0458");
    set_city_code("020");
}

void MainWindow::on_action_197_triggered()
{
    set_html_city("武汉");
    set_city_code("027");
}

void MainWindow::on_action_198_triggered()
{
    set_html_city("黄石");
    set_city_code("0714");
}

void MainWindow::on_action_199_triggered()
{
    set_html_city("黄冈");
    set_city_code("0713");
}

void MainWindow::on_action_200_triggered()
{
    set_html_city("荆州");
    set_city_code("0716");
}

void MainWindow::on_action_201_triggered()
{
    set_html_city("荆门");
    set_city_code("0724");
}

void MainWindow::on_action_202_triggered()
{
    set_html_city("潜江");
    set_city_code("0728");
}

void MainWindow::on_action_203_triggered()
{
    set_html_city("十堰");
    set_city_code("0719");
}

void MainWindow::on_action_204_triggered()
{
    set_html_city("随州");
    set_city_code("0722");
}

void MainWindow::on_action_205_triggered()
{
    set_html_city("神农架");
    set_city_code("0719");
}

void MainWindow::on_action_206_triggered()
{
    set_html_city("天门");
    set_city_code("0728");
}

void MainWindow::on_action_207_triggered()
{
    set_html_city("襄阳");
    set_city_code("0710");
}

void MainWindow::on_action_208_triggered()
{
    set_html_city("孝感");
    set_city_code("0712");
}

void MainWindow::on_action_209_triggered()
{
    set_html_city("咸宁");
    set_city_code("0715");
}

void MainWindow::on_action_210_triggered()
{
    set_html_city("仙桃");
    set_city_code("0728");
}

void MainWindow::on_action_211_triggered()
{
    set_html_city("鄂州");
    set_city_code("0711");
}

void MainWindow::on_action_212_triggered()
{
    set_html_city("宜昌");
    set_city_code("0717");
}

void MainWindow::on_action_213_triggered()
{
    set_html_city("长沙");
    set_city_code("0731");
}

void MainWindow::on_action_214_triggered()
{
    set_html_city("郴州");
    set_city_code("0735");
}

void MainWindow::on_action_215_triggered()
{
    set_html_city("常德");
    set_city_code("0736");
}

void MainWindow::on_action_216_triggered()
{
    set_html_city("衡阳");
    set_city_code("0734");
}

void MainWindow::on_action_217_triggered()
{
    set_html_city("怀化");
    set_city_code("0745");
}

void MainWindow::on_action_218_triggered()
{
    set_html_city("娄底");
    set_city_code("0738");
}

void MainWindow::on_action_219_triggered()
{
    set_html_city("邵阳");
    set_city_code("0739");
}

void MainWindow::on_action_220_triggered()
{
    set_html_city("湘潭");
    set_city_code("0732");
}

void MainWindow::on_action_221_triggered()
{
    set_html_city("湘西");
    set_city_code("0743");
}

void MainWindow::on_action_222_triggered()
{
    set_html_city("岳阳");
    set_city_code("0730");
}

void MainWindow::on_action_223_triggered()
{
    set_html_city("永州");
    set_city_code("0746");
}

void MainWindow::on_action_224_triggered()
{
    set_html_city("益阳");
    set_city_code("0737");
}

void MainWindow::on_action_225_triggered()
{
    set_html_city("张家界");
    set_city_code("0744");
}

void MainWindow::on_action_226_triggered()
{
    set_html_city("株洲");
    set_city_code("0733");
}

void MainWindow::on_action_227_triggered()
{
    set_html_city("长春");
    set_city_code("0431");
}

void MainWindow::on_action_228_triggered()
{
    set_html_city("白城");
    set_city_code("0436");
}

void MainWindow::on_action_229_triggered()
{
    set_html_city("白山");
    set_city_code("0439");
}

void MainWindow::on_action_230_triggered()
{
    set_html_city("吉林市");
    set_city_code("0432");
}

void MainWindow::on_action_231_triggered()
{
    set_html_city("辽源");
    set_city_code("0437");
}

void MainWindow::on_action_232_triggered()
{
    set_html_city("四平");
    set_city_code("0434");
}

void MainWindow::on_action_233_triggered()
{
    set_html_city("通化");
    set_city_code("0435");
}

void MainWindow::on_action_234_triggered()
{
    set_html_city("松原");
    set_city_code("0438");
}

void MainWindow::on_action_235_triggered()
{
    set_html_city("延边");
    set_city_code("0433");
}

void MainWindow::on_action_236_triggered()
{
    set_html_city("南京");
    set_city_code("025");
}

void MainWindow::on_action_237_triggered()
{
    set_html_city("常州");
    set_city_code("0519");
}

void MainWindow::on_action_238_triggered()
{
    set_html_city("淮安");
    set_city_code("0517");
}

void MainWindow::on_action_239_triggered()
{
    set_html_city("连云港");
    set_city_code("0518");
}

void MainWindow::on_action_240_triggered()
{
    set_html_city("南通");
    set_city_code("0513");
}

void MainWindow::on_action_241_triggered()
{
    set_html_city("苏州");
    set_city_code("0512");
}

void MainWindow::on_action_242_triggered()
{
    set_html_city("宿迁");
    set_city_code("0527");
}

void MainWindow::on_action_243_triggered()
{
    set_html_city("泰州");
    set_city_code("0523");
}

void MainWindow::on_action_244_triggered()
{
    set_html_city("无锡");
    set_city_code("0510");
}

void MainWindow::on_action_245_triggered()
{
    set_html_city("徐州");
    set_city_code("0516");
}

void MainWindow::on_action_246_triggered()
{
    set_html_city("扬州");
    set_city_code("0514");
}

void MainWindow::on_action_247_triggered()
{
    set_html_city("盐城");
    set_city_code("0515");
}

void MainWindow::on_action_248_triggered()
{
    set_html_city("镇江");
    set_city_code("0511");
}

void MainWindow::on_action_249_triggered()
{
    set_html_city("南昌");
    set_city_code("0791");
}

void MainWindow::on_action_250_triggered()
{
    set_html_city("抚州");
    set_city_code("0794");
}

void MainWindow::on_action_251_triggered()
{
    set_html_city("赣州");
    set_city_code("0797");
}

void MainWindow::on_action_252_triggered()
{
    set_html_city("九江");
    set_city_code("0792");
}

void MainWindow::on_action_253_triggered()
{
    set_html_city("景德镇");
    set_city_code("0798");
}

void MainWindow::on_action_254_triggered()
{
    set_html_city("吉安");
    set_city_code("0796");
}

void MainWindow::on_action_255_triggered()
{
    set_html_city("萍乡");
    set_city_code("0799");
}

void MainWindow::on_action_256_triggered()
{
    set_html_city("上饶");
    set_city_code("0793");
}

void MainWindow::on_action_257_triggered()
{
    set_html_city("新余");
    set_city_code("0790");
}

void MainWindow::on_action_258_triggered()
{
    set_html_city("宜春");
    set_city_code("0795");
}

void MainWindow::on_action_259_triggered()
{
    set_html_city("鹰潭");
    set_city_code("0701");
}

void MainWindow::on_action_260_triggered()
{
    set_html_city("沈阳");
    set_city_code("024");
}

void MainWindow::on_action_261_triggered()
{
    set_html_city("鞍山");
    set_city_code("0412");
}

void MainWindow::on_action_262_triggered()
{
    set_html_city("本溪");
    set_city_code("0414");
}

void MainWindow::on_action_263_triggered()
{
    set_html_city("朝阳");
    set_city_code("0421");
}

void MainWindow::on_action_264_triggered()
{
    set_html_city("大连");
    set_city_code("0411");
}

void MainWindow::on_action_265_triggered()
{
    set_html_city("丹东");
    set_city_code("0415");
}

void MainWindow::on_action_266_triggered()
{
    set_html_city("阜新");
    set_city_code("0418");
}

void MainWindow::on_action_267_triggered()
{
    set_html_city("抚顺");
    set_city_code("0413");
}

void MainWindow::on_action_268_triggered()
{
    set_html_city("葫芦岛");
    set_city_code("0429");
}

void MainWindow::on_action_269_triggered()
{
    set_html_city("锦州");
    set_city_code("0416");
}

void MainWindow::on_action_270_triggered()
{
    set_html_city("辽阳");
    set_city_code("0419");
}

void MainWindow::on_action_271_triggered()
{
    set_html_city("盘锦");
    set_city_code("0427");
}

void MainWindow::on_action_272_triggered()
{
    set_html_city("铁岭");
    set_city_code("0410");
}

void MainWindow::on_action_273_triggered()
{
    set_html_city("营口");
    set_city_code("0417");
}

void MainWindow::on_action_274_triggered()
{
    set_html_city("呼和浩特");
    set_city_code("0471");
}

void MainWindow::on_action_275_triggered()
{
    set_html_city("阿拉善");
    set_city_code("0483");
}

void MainWindow::on_action_276_triggered()
{
    set_html_city("包头");
    set_city_code("0472");
}

void MainWindow::on_action_277_triggered()
{
//    set_html_city("巴彦淖尔");
//    set_city_code("020");
}

void MainWindow::on_action_278_triggered()
{
    set_html_city("赤峰");
    set_city_code("0476");
}

void MainWindow::on_action_279_triggered()
{
    set_html_city("鄂尔多斯");
    set_city_code("0477");
}

void MainWindow::on_action_280_triggered()
{
    set_html_city("呼伦贝尔");
    set_city_code("0470");
}

void MainWindow::on_action_281_triggered()
{
    set_html_city("通辽");
    set_city_code("0475");
}

void MainWindow::on_action_282_triggered()
{
    set_html_city("乌兰察布");
    set_city_code("0474");
}

void MainWindow::on_action_283_triggered()
{
    set_html_city("乌海");
    set_city_code("0473");
}

void MainWindow::on_action_284_triggered()
{
    set_html_city("兴安盟");
    set_city_code("0482");
}

void MainWindow::on_action_285_triggered()
{
    set_html_city("锡林郭勒盟");
    set_city_code("0479");
}

void MainWindow::on_action_286_triggered()
{
    set_html_city("银川");
    set_city_code("0951");
}

void MainWindow::on_action_287_triggered()
{
    set_html_city("固原");
    set_city_code("0954");
}

void MainWindow::on_action_288_triggered()
{
    set_html_city("石嘴山");
    set_city_code("0952");
}

void MainWindow::on_action_289_triggered()
{
    set_html_city("吴忠");
    set_city_code("0953");
}

void MainWindow::on_action_290_triggered()
{
    set_html_city("中卫");
    set_city_code("0953");
}

void MainWindow::on_action_291_triggered()
{
    set_html_city("西宁");
    set_city_code("0971");
}

void MainWindow::on_action_292_triggered()
{
    set_html_city("果洛");
    set_city_code("0975");
}

void MainWindow::on_action_293_triggered()
{
    set_html_city("海东");
    set_city_code("0972");
}

void MainWindow::on_action_294_triggered()
{
    set_html_city("海北");
    set_city_code("0970");
}

void MainWindow::on_action_295_triggered()
{
    set_html_city("黄南");
    set_city_code("0973");
}

void MainWindow::on_action_296_triggered()
{
    set_html_city("海南州");
    set_city_code("0974");
}

void MainWindow::on_action_297_triggered()
{
    set_html_city("海西");
    set_city_code("0977");
}

void MainWindow::on_action_298_triggered()
{
    set_html_city("玉树");
    set_city_code("0976");
}

void MainWindow::on_action_299_triggered()
{
    set_html_city("济南");
    set_city_code("0531");
}

void MainWindow::on_action_300_triggered()
{
    set_html_city("滨州");
    set_city_code("0543");
}

void MainWindow::on_action_301_triggered()
{
    set_html_city("德州");
    set_city_code("0534");
}

void MainWindow::on_action_302_triggered()
{
    set_html_city("东营");
    set_city_code("0546");
}

void MainWindow::on_action_303_triggered()
{
    set_html_city("菏泽");
    set_city_code("0530");
}

void MainWindow::on_action_304_triggered()
{
    set_html_city("济宁");
    set_city_code("0537");
}

void MainWindow::on_action_305_triggered()
{
    set_html_city("临沂");
    set_city_code("0539");
}

void MainWindow::on_action_306_triggered()
{
    set_html_city("聊城");
    set_city_code("0635");
}

void MainWindow::on_action_307_triggered()
{
    set_html_city("莱芜");
    set_city_code("0634");
}

void MainWindow::on_action_308_triggered()
{
    set_html_city("青岛");
    set_city_code("0532");
}

void MainWindow::on_action_309_triggered()
{
    set_html_city("日照");
    set_city_code("0633");
}

void MainWindow::on_action_310_triggered()
{
    set_html_city("泰安");
    set_city_code("0538");
}

void MainWindow::on_action_311_triggered()
{
    set_html_city("威海");
    set_city_code("0631");
}

void MainWindow::on_action_312_triggered()
{
    set_html_city("潍坊");
    set_city_code("0536");
}

void MainWindow::on_action_313_triggered()
{
    set_html_city("烟台");
    set_city_code("0535");
}

void MainWindow::on_action_314_triggered()
{
    set_html_city("淄博");
    set_city_code("0533");
}

void MainWindow::on_action_315_triggered()
{
    set_html_city("枣庄");
    set_city_code("0632");
}

void MainWindow::on_action_316_triggered()
{
    set_html_city("太原");
    set_city_code("0351");
}

void MainWindow::on_action_317_triggered()
{
    set_html_city("长治");
    set_city_code("0355");
}

void MainWindow::on_action_318_triggered()
{
    set_html_city("大同");
    set_city_code("0352");
}

void MainWindow::on_action_319_triggered()
{
    set_html_city("晋城");
    set_city_code("0356");
}

void MainWindow::on_action_320_triggered()
{
    set_html_city("晋中");
    set_city_code("0354");
}

void MainWindow::on_action_321_triggered()
{
    set_html_city("临汾");
    set_city_code("0357");
}

void MainWindow::on_action_322_triggered()
{
    set_html_city("吕梁");
    set_city_code("0358");
}

void MainWindow::on_action_323_triggered()
{
    set_html_city("朔州");
    set_city_code("0349");
}

void MainWindow::on_action_324_triggered()
{
    set_html_city("阳泉");
    set_city_code("0353");
}

void MainWindow::on_action_325_triggered()
{
    set_html_city("忻州");
    set_city_code("0350");
}

void MainWindow::on_action_326_triggered()
{
    set_html_city("运城");
    set_city_code("0359");
}

void MainWindow::on_action_327_triggered()
{
    set_html_city("西安");
    set_city_code("029");
}

void MainWindow::on_action_328_triggered()
{
    set_html_city("安康");
    set_city_code("0915");
}

void MainWindow::on_action_329_triggered()
{
    set_html_city("宝鸡");
    set_city_code("0917");
}

void MainWindow::on_action_330_triggered()
{
    set_html_city("汉中");
    set_city_code("0916");
}

void MainWindow::on_action_331_triggered()
{
    set_html_city("商洛");
    set_city_code("0914");
}

void MainWindow::on_action_332_triggered()
{
    set_html_city("铜川");
    set_city_code("0919");
}

void MainWindow::on_action_333_triggered()
{
    set_html_city("渭南");
    set_city_code("0913");
}

void MainWindow::on_action_334_triggered()
{
    set_html_city("咸阳");
    set_city_code("0910");
}

void MainWindow::on_action_335_triggered()
{
    set_html_city("延安");
    set_city_code("0911");
}

void MainWindow::on_action_336_triggered()
{
    set_html_city("榆林");
    set_city_code("0912");
}

void MainWindow::on_action_337_triggered()
{
    set_html_city("成都");
    set_city_code("028");
}

void MainWindow::on_action_338_triggered()
{
    set_html_city("巴中");
    set_city_code("0827");
}

void MainWindow::on_action_339_triggered()
{
    set_html_city("阿坝");
    set_city_code("0837");
}

void MainWindow::on_action_340_triggered()
{
    set_html_city("达州");
    set_city_code("0818");
}

void MainWindow::on_action_341_triggered()
{
    set_html_city("德阳");
    set_city_code("0838");
}

void MainWindow::on_action_342_triggered()
{
    set_html_city("广元");
    set_city_code("0839");
}

void MainWindow::on_action_343_triggered()
{
    set_html_city("广安");
    set_city_code("0826");
}

void MainWindow::on_action_344_triggered()
{
    set_html_city("甘孜");
    set_city_code("0836");
}

void MainWindow::on_action_345_triggered()
{
    set_html_city("乐山");
    set_city_code("0833");
}

void MainWindow::on_action_346_triggered()
{
    set_html_city("凉山");
    set_city_code("0834");
}

void MainWindow::on_action_347_triggered()
{
    set_html_city("泸州");
    set_city_code("0830");
}

void MainWindow::on_action_348_triggered()
{
    set_html_city("绵阳");
    set_city_code("0816");
}

void MainWindow::on_action_349_triggered()
{
    set_html_city("眉山");
    set_city_code("0833");
}

void MainWindow::on_action_350_triggered()
{
    set_html_city("内江");
    set_city_code("0832");
}

void MainWindow::on_action_351_triggered()
{
    set_html_city("南充");
    set_city_code("0817");
}

void MainWindow::on_action_352_triggered()
{
    set_html_city("攀枝花");
    set_city_code("0812");
}

void MainWindow::on_action_353_triggered()
{
    set_html_city("遂宁");
    set_city_code("0825");
}

void MainWindow::on_action_354_triggered()
{
    set_html_city("宜宾");
    set_city_code("0831");
}

void MainWindow::on_action_355_triggered()
{
    set_html_city("雅安");
    set_city_code("0835");
}

void MainWindow::on_action_356_triggered()
{
    set_html_city("自贡");
    set_city_code("0813");
}

void MainWindow::on_action_357_triggered()
{
    set_html_city("资阳");
    set_city_code("0832");
}

void MainWindow::on_action_358_triggered()
{
    set_html_city("拉萨");
    set_city_code("0891");
}

void MainWindow::on_action_359_triggered()
{
    set_html_city("阿里");
    set_city_code("0897");
}

void MainWindow::on_action_360_triggered()
{
    set_html_city("昌都");
    set_city_code("0895");
}

void MainWindow::on_action_361_triggered()
{
    set_html_city("林芝");
    set_city_code("0894");
}

void MainWindow::on_action_362_triggered()
{
    set_html_city("那曲");
    set_city_code("0896");
}

void MainWindow::on_action_363_triggered()
{
    set_html_city("日喀则");
    set_city_code("0892");
}

void MainWindow::on_action_364_triggered()
{
    set_html_city("山南");
    set_city_code("0893");
}

void MainWindow::on_action_365_triggered()
{
    set_html_city("乌鲁木齐");
    set_city_code("0991");
}

void MainWindow::on_action_366_triggered()
{
    set_html_city("阿克苏");
    set_city_code("0997");
}

void MainWindow::on_action_367_triggered()
{
    set_html_city("阿勒泰");
    set_city_code("0906");
}

void MainWindow::on_action_368_triggered()
{
    set_html_city("巴音郭楞");
    set_city_code("0996");
}

void MainWindow::on_action_369_triggered()
{
//    set_html_city("博尔塔拉");
//    set_city_code("020");
}

void MainWindow::on_action_370_triggered()
{
    set_html_city("昌吉");
    set_city_code("0994");
}

void MainWindow::on_action_371_triggered()
{
    set_html_city("哈密");
    set_city_code("0902");
}

void MainWindow::on_action_372_triggered()
{
    set_html_city("和田");
    set_city_code("0903");
}

void MainWindow::on_action_373_triggered()
{
    set_html_city("克拉玛依");
    set_city_code("0990");
}

void MainWindow::on_action_374_triggered()
{
//    set_html_city("克孜勒苏");
//    set_city_code("020");
}

void MainWindow::on_action_375_triggered()
{
    set_html_city("喀什");
    set_city_code("0998");
}

void MainWindow::on_action_376_triggered()
{
    set_html_city("石河子");
    set_city_code("0993");
}

void MainWindow::on_action_377_triggered()
{
    set_html_city("吐鲁番");
    set_city_code("0995");
}

void MainWindow::on_action_378_triggered()
{
    set_html_city("塔城");
    set_city_code("0901");
}

void MainWindow::on_action_379_triggered()
{
    set_html_city("伊犁");
    set_city_code("0992");
}

void MainWindow::on_action_380_triggered()
{
//    set_html_city("阿拉尔");
//    set_city_code("020");
}

void MainWindow::on_action_381_triggered()
{
//    set_html_city("图木舒克");
//    set_city_code("020");
}

void MainWindow::on_action_383_triggered()
{
//    set_html_city("五家渠");
//    set_city_code("020");
}

void MainWindow::on_action_384_triggered()
{
    set_html_city("昆明");
    set_city_code("0871");
}

void MainWindow::on_action_385_triggered()
{
    set_html_city("保山");
    set_city_code("0875");
}

void MainWindow::on_action_387_triggered()
{
    set_html_city("大理");
    set_city_code("0872");
}

void MainWindow::on_action_388_triggered()
{
    set_html_city("德宏");
    set_city_code("0692");
}

void MainWindow::on_action_389_triggered()
{
    set_html_city("迪庆");
    set_city_code("0887");
}

void MainWindow::on_action_390_triggered()
{
    set_html_city("红河");
    set_city_code("0873");
}

void MainWindow::on_action_391_triggered()
{
    set_html_city("临沧");
    set_city_code("0883");
}

void MainWindow::on_action_392_triggered()
{
    set_html_city("丽江");
    set_city_code("0888");
}

void MainWindow::on_action_393_triggered()
{
    set_html_city("怒江");
    set_city_code("0886");
}

void MainWindow::on_action_394_triggered()
{
    set_html_city("普洱");
    set_city_code("0879");
}

void MainWindow::on_action_395_triggered()
{
    set_html_city("曲靖");
    set_city_code("0874");
}

void MainWindow::on_action_396_triggered()
{
    set_html_city("文山");
    set_city_code("0876");
}

void MainWindow::on_action_397_triggered()
{
    set_html_city("西双版纳");
    set_city_code("0691");
}

void MainWindow::on_action_398_triggered()
{
    set_html_city("玉溪");
    set_city_code("0877");
}

void MainWindow::on_action_399_triggered()
{
    set_html_city("昭通");
    set_city_code("0870");
}

void MainWindow::on_action_400_triggered()
{
    set_html_city("杭州");
    set_city_code("0571");
}

void MainWindow::on_action_401_triggered()
{
    set_html_city("湖州");
    set_city_code("0572");
}

void MainWindow::on_action_402_triggered()
{
    set_html_city("嘉兴");
    set_city_code("0573");
}

void MainWindow::on_action_403_triggered()
{
    set_html_city("金华");
    set_city_code("0579");
}

void MainWindow::on_action_404_triggered()
{
    set_html_city("丽水");
    set_city_code("0578");
}

void MainWindow::on_action_405_triggered()
{
    set_html_city("宁波");
    set_city_code("0574");
}

void MainWindow::on_action_406_triggered()
{
    set_html_city("绍兴");
    set_city_code("0575");
}

void MainWindow::on_action_407_triggered()
{
    set_html_city("台州");
    set_city_code("0576");
}

void MainWindow::on_action_408_triggered()
{
    set_html_city("温州");
    set_city_code("0577");
}

void MainWindow::on_action_409_triggered()
{
    set_html_city("舟山");
    set_city_code("0580");
}


